Add correlated V2 runtime latency profiles - #574
Conversation
Signed-off-by: Ziming Wang <zimingwang945@gmail.com>
Greptile SummaryThe PR adds opt-in JSONL profiling for V2 host-side input latency, correlating timestamped input with UI-loop claims and subsequent client-window writes.
Confidence Score: 4/5The PR is not yet safe to merge because disconnected WebRTC tracks can still report sender admission and finalize latency correlations without an active sender. ZenAlexa reported that commit Files Needing Attention: flashdreams/flashdreams/runtime_v2/serving/webrtc_server.py Important Files Changed
Sequence DiagramsequenceDiagram
participant I as Input source
participant B as EventBuffer
participant U as UI loop
participant P as RuntimeProfiler
participant W as Client window
I->>B: Timestamped input event
B->>U: Claim event batch
U->>P: ui_step_started(events)
U->>W: write(StepResult)
W-->>U: write returns
U->>P: window_write_completed()
P->>P: Emit JSONL records and summaries
Reviews (7): Last reviewed commit: "Bound and describe runtime latency profi..." | Re-trigger Greptile |
Linearize peer availability and frame admission under the track state lock. Preserve negotiation queuing and reopen admission after peer recovery. Signed-off-by: Ziming Wang <zimingwang945@gmail.com>
Keep the timestamp clock bridge on a dedicated input-source extension. Measure IUILoop claim and the first following window write. Remove transport-specific and duplicated stage instrumentation. Signed-off-by: Ziming Wang <zimingwang945@gmail.com>
Define WebRTC timing at the existing single-slot sender mailbox write. Keep active-peer delivery and display timing in matching client telemetry. Signed-off-by: Ziming Wang <zimingwang945@gmail.com>
|
Good catch to check this race. |
…r-input-latency-instrumentation Signed-off-by: Ziming Wang <zimingwang945@gmail.com> # Conflicts: # flashdreams/flashdreams/runtime_v2/application_runner.py # flashdreams/flashdreams/runtime_v2/cli.py # flashdreams/flashdreams/runtime_v2/session_runner.py # flashdreams/flashdreams/runtime_v2/webrtc_client_window.py
|
Pulled #548's multi-session lifecycle into Each replacement now gets a fresh clock binding and an independent JSONL segment, with WebRTC's rebased timestamps mapped back to the correct monotonic session origin. The complete V2 CPU suite passes: 211 passed, 3 deselected. The two metrics remain anchored at IUILoop claim and the first following window write (ง •̀_•́)ง |
|
I rechecked this against current HEAD and the PR diff. This review keeps the transport contract unchanged and keeps #574 scoped to the two host-side perceived-latency checkpoints (•̀ᴗ•́)و |
…r-input-latency-instrumentation Signed-off-by: Ziming Wang <zimingwang945@gmail.com> # Conflicts: # flashdreams/flashdreams/runtime_v2/session_runner.py
Signed-off-by: Ziming Wang <zimingwang945@gmail.com>
|
Synced current |
jmccaffrey-nv
left a comment
There was a problem hiding this comment.
Reviewed the implementation against #538, including native/WebRTC clock bridging, replacement-session ownership, correlation, cleanup, path collisions, security, and profiler overhead.
The PR satisfies the narrowed host-side checkpoints discussed on the issue: event receipt to IUILoop claim, and event receipt to the next window.write return. The latter is not causal or end-to-end perceived response latency: the UI can re-render a held pre-input frame, and WebRTC stops at host queue admission before transport, decode, composition, and scanout. The documentation states these limits; please keep that distinction explicit when closing #538.
Local validation at 0e007995: 215 V2 CPU tests passed; focused Ruff formatting/import checks, ty, compileall, and git diff --check passed. The documentation build reached the new section without a new warning; its warning-as-error run still reports 10 unrelated baseline warnings. GitHub currently shows only the successful Greptile check while NVIDIA runner validation awaits vetting.
I left three inline comments on self-describing profile metadata, unbounded in-memory summary retention, and stable event-type serialization. I found no new code-execution, deserialization, dependency, or credential-handling exposure.
-- reviewed using GPT-5.6 Sol
|
/ok to test 0e00799 |
…r-input-latency-instrumentation Signed-off-by: Ziming Wang <zimingwang945@gmail.com>
Signed-off-by: Ziming Wang <zimingwang945@gmail.com>
|
Addressed the three review threads in Validation: 185 V2 CPU tests passed, 5 skipped in the local optional-dependency environment; 88 focused tests passed, 1 skipped; Ruff, focused |
|
Want your agent to iterate on Greptile's feedback? Try greploops. |
Summary
I added opt-in host-side input profiling through
flashdreams-run-v2 --profile-path. It writes JSONL records from each input event's timestamp to the IUILoop claim and the first following client-window write. A dedicatedTimestampedInputSourceextension supplies the clock origin for session-relative timestamps.Closes #538
Measurement boundaries
input_to_ui_step_sends when the IUILoop claims the input.input_to_window_write_sends when the first followingIClientWindow.writecall returns. That write can present a held frame from before the input; the metric records the next host write completion. Measuring a rendered response to that input requires additional correlation.For a native window, the endpoint normally follows the presenter call. WebRTC with an active video track ends after host materialization and admission to the bounded two-frame sender queue. A server waiting for a video track returns after shape validation. Active-peer delivery, RTP transit, browser decode, compositor scheduling, and physical scanout require client telemetry.
Each session segment records its runtime settings and measurement endpoints. Summaries report exact count and maximum values. Median and p90 use all observations through 1,024 samples, then use a bounded uniform reservoir; the artifact records the sample count and approximation status. The profile path is kept distinct from model statistics, MP4 output, and an enabled chunk lifecycle trace.
Validation
At
020fddb4, I ran the V2 CPU suite in the local optional-dependency environment: 185 passed and 5 skipped. The focused suite completed with 88 passed and 1 skipped.tychecks, compileall, andgit diff --checkpassed.